package sign_in.loginsystem.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import sign_in.loginsystem.annotation.Permissions;
import sign_in.loginsystem.model.util.RBody;
import sign_in.loginsystem.model.util.Result;
import sign_in.loginsystem.service.port.MenuServes;

@RestController
public class MenuController {


    @Autowired
    MenuServes menuServes;

    @PostMapping("/menu")
    @Permissions(permission = "admin:list")
    public Result allMenu(@RequestBody RBody body){
        return Result.success(menuServes.allMenu(body));
    }

    @PostMapping("/editMenu")
    @Permissions(permission = "admin:edit")
    public Result editMenu(@RequestBody RBody body){
       return Result.success(menuServes.editMenu(body));
    }

    @PostMapping("/delMenu")
    @Permissions(permission = "admin:delete")
    public Result delMenu(@RequestBody RBody body){
        return Result.success(menuServes.delMenu(body));
    }

    @PostMapping("/createMenu")
    @Permissions(permission = "admin:create")
    public Result createMenu(@RequestBody RBody body){
        return Result.success(menuServes.createMenu(body));
    }

}
